﻿using System;
using System.Text;
using System.Security.Cryptography;
namespace Com.Common.Cms
{
    public class Encrypt
    {
        public static string Md5(string input, System.Text.Encoding encode, bool isUpper)
        {
            MD5 m = new MD5CryptoServiceProvider();
            byte[] s = m.ComputeHash(encode.GetBytes(input));
            String result = BitConverter.ToString(s);
            result = result.Replace("-", "");
            if (isUpper)
            {
                return result.ToUpper();
            }
            else
            {
                return result.ToLower();
            }
        }
    }
}
